package nl.ceasaro.jeslee.core.dao.impl;

import org.springframework.util.ClassUtils;
import nl.ceasaro.jeslee.core.dao.GenericDAO;

import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class AbstractDAO<T, ID extends Serializable>
      implements GenericDAO<T, ID>
{
   private Class<T> persistentClass;

   public AbstractDAO()
   {
      Type type = ((ParameterizedType) ClassUtils.getUserClass(getClass())
            .getGenericSuperclass()).getActualTypeArguments()[0];
      this.persistentClass = (Class<T>) type;
   }

   public Class<T> getPojoClass()
   {
      return this.persistentClass;
   }
}
